﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Common.DataAnnotations
{
    /// <summary>
    /// 时间模式（HH:mm:ss）
    /// </summary>
    public class TimeAttribute : RegularExpressionAttribute
    {
        const string TimePattern = @"^((([0-1]?[0-9])|(2[0-3])):([0-5]?[0-9])(:[0-5]?[0-9])?)$";
        /// <summary>
        /// 
        /// </summary>
        public TimeAttribute() : base(TimePattern)
        {
            ErrorMessage = "{0}格式不正确";
        }
    }
}
